.app-container {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 200px;
  background-color: #f0f0f0;
  padding: 20px;
  border-right: 1px solid #ccc;
}

.new-conversation-btn,
.history-btn {
  width: 100%;
  margin-bottom: 10px;
  padding: 10px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.new-conversation-btn:hover,
.history-btn:hover {
  background-color: #0056b3;
}

.history-list {
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 10px;
}

.chat-container {
  flex: 1;
  padding: 20px;
}

body {
  font-family: 'Noto Sans SC', sans-serif;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom); /* iOS安全区域 */
  -webkit-overflow-scrolling: touch; /* 平滑滚动 */
}

.chat-container {
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.message {
  display: inline-block; /* 让元素根据内容宽度显示 */
  margin: 10px;
  padding: 12px;
  border-radius: 8px;
  max-width: 80%; /* 限制最大宽度 */
  word-break: break-word; /* 允许长单词换行 */
  min-width: 40px; /* 设置最小宽度，避免内容过少时泡泡过小 */
}

/* 聊天容器添加 flex 布局 */
.messages {
  display: flex;
  flex-direction: column;
}

.message.user {
  background: #007bff;
  color: white;
  border-radius: 20px 20px 5px 20px;
  margin-left: auto; /* 右对齐 */
  margin-right: 10px; /* 调整右边距 */
}

.message.ai {
  background: #ffffff;
  color: #333;
  border-radius: 20px 20px 20px 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-left: 10px; /* 调整左边距 */
  margin-right: auto; /* 左对齐 */
}

.input-area {
  display: flex;
  gap: 10px;
}

/* 文件上传样式 */
.file-upload {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-button {
  padding: 8px 12px;
  background: #4CAF50;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

.file-name {
  color: #666;
  font-size: 0.9em;
}

/* 进度条样式 */
.progress-bar {
  width: 100px;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.progress {
  height: 100%;
  background: #2196F3;
  transition: width 0.3s ease;
}

/* 文件上传样式 */
.file-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.upload-button {
  padding: 8px 15px;
  background: #2196F3;
  color: white;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.3s;
}

.upload-button:hover {
  background: #1976D2;
}

.file-name {
  color: #666;
  font-size: 0.9em;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 进度条样式 */
.progress-bar {
  width: 100%;
  height: 4px;
  background: #eee;
  border-radius: 2px;
  margin: 8px 0;
}

.progress {
  height: 100%;
  background: #4CAF50;
  transition: width 0.3s ease;
}

/* 输入组布局 */
.input-group {
  display: flex;
  gap: 10px;
}

.input-group input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 20px;
}

.message {
  display: block;
  white-space: pre-wrap; /* 保留换行符 */
  word-break: break-word;
}

/* 添加消息容器滚动条 */
.messages {
  overflow-y: auto;
  padding: 10px;
  height: 70vh;
}

/* 确保消息可见性 */
.message {
  display: block;
  margin: 10px 0;
  padding: 12px;
  border-radius: 8px;
  max-width: 80%;
}

.chat-container {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  padding: 2rem;
}

/* 消息容器玻璃效果 */
.messages {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 消息气泡样式增强 */
.message {
  position: relative;
  margin: 1rem;
  padding: 1.2rem 1.5rem;
  font-size: 1.1rem;
  line-height: 1.5;
  transition: transform 0.3s ease;
}

.message.user {
  background: #007bff;
  color: white;
  border-radius: 20px 20px 5px 20px;
  margin-left: 15%;
}

.message.ai {
  background: #ffffff;
  color: #333;
  border-radius: 20px 20px 20px 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-right: 15%;
}

/* 输入区域美化 */
.input-area {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* 按钮渐变效果 */
button {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  border: none;
  padding: 0.8rem 1.5rem;
  color: white;
  border-radius: 25px;
  cursor: pointer;
  transition: transform 0.2s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* 文件上传按钮美化 */
.upload-button {
  background: linear-gradient(135deg, #28a745 0%, #218838 100%);
  border-radius: 25px;
  padding: 0.8rem 1.5rem;
}

/* 进度条动画 */
.progress {
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 输入框聚焦效果 */
input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

/* 消息气泡点击效果 */
.message.file {
  background: #e3f2fd;
  border-left: 4px solid #2196F3;
}

.file-message {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.error {
  color: #d32f2f;
  font-weight: bold;
}

/* 进度条调整 */
.progress-bar {
  height: 6px;
  background: rgba(0,0,0,0.1);
}

.progress {
  height: 100%;
  background: #4CAF50;
  transition: width 0.3s ease;
}

.history-list {
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 10px;
  margin-top: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  margin: 5px 0;
  padding: 5px;
  border-radius: 3px;
}

.history-item a {
  color: #007bff;
  text-decoration: none;
  cursor: pointer;
}

.history-item a:hover {
  text-decoration: underline;
}

.history-item.user {
  background-color: #e3f2fd;
}

.history-item.ai {
  background-color: #f1f8e9;
}

.history-item.file {
  background-color: #fff3e0;
}

.delete-btn {
  margin-left: 10px;
  padding: 2px 8px;
  background-color: #ff4444;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.delete-btn:hover {
  background-color: #cc0000;
}

